<%@page contentType="text/html" import="java.sql.*"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<jsp:useBean id="event" scope="session" class="com.asaga.tools.Event_DBImpl" />
<jsp:useBean id="userProfile" scope="session" class="com.asaga.tools.SystemClient_DBImpl" />
<jsp:useBean id="location" scope="session" class="com.asaga.tools.Location_DBImpl" />
<jsp:useBean id="fontBean" scope="session" class="com.asaga.tools.FontBean" />
<jsp:setProperty name="fontBean" property="*" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%  
String username = (String)session.getAttribute("username");
if(username==null){
    response.sendRedirect("login.jsp?message=Please log in again.");
}
%>
<html>
<%@ include file="header.jsp" %>
<body onload="javascript:hide(document.getElementById('locationForm'))">
<div id="container">
    <%@ include file="topNav.jsp" %>
    <%@ include file="leftside.jsp" %>
    <%@ include file="rightside.jsp" %>
  <div id="content">
                <p id="warning"><jsp:getProperty name="event" property="warningMessage" />
                </p>
                <h4 class="heading">Add an Event</h4><br />
                <form method="get" action="AutismSiteMasterController">
                    <fieldset id="eventFields">
                        <legend>Event Information</legend>
                        <table class="eventForm">
                            <tr><td>
                                    Event Title:
                                </td>
                                <td><input type="text" name="title" value="" size="40" />
                                </td>
                            </tr>
                            <tr><td>
                                    Start Date:
                                </td>
                                <td>
                                    <input type="text" name="startDate" value="" size="10" /> (mm/dd/yyyy)
                                </td>
                            </tr>
                            <tr><td>
                                    End Date:
                                </td>
                                <td><input type="text" name="endDate" value="" size="10" /> (mm/dd/yyyy)
                                    
                                </td>
                            </tr>
                            <tr><td>
                                    Start Time:
                                </td>
                                <td><select name="starthr">
                                        <option>--</option>
                                        <option>01</option>
                                        <option>02</option>
                                        <option>03</option>
                                        <option>04</option>
                                        <option>05</option>
                                        <option>06</option>
                                        <option>07</option>
                                        <option>08</option>
                                        <option>09</option>
                                        <option>10</option>
                                        <option>11</option>
                                        <option>12</option>
                                    </select> : 
                                    <select name="startmin">
                                        <option>--</option>
                                        <option>00</option>
                                        <option>30</option>
                                    </select>  
                                     <select name="startmer">
                                        <option>--</option>
                                        <option>AM</option>
                                        <option>PM</option>
                                    </select>
                                </td>
                            </tr>
                            <tr><td>
                                    End Time:
                                </td>
                                <td><select name="endhr">
                                        <option>--</option>
                                        <option>01</option>
                                        <option>02</option>
                                        <option>03</option>
                                        <option>04</option>
                                        <option>05</option>
                                        <option>06</option>
                                        <option>07</option>
                                        <option>08</option>
                                        <option>09</option>
                                        <option>10</option>
                                        <option>11</option>
                                        <option>12</option>
                                    </select> : 
                                    <select name="endmin">
                                        <option>--</option>
                                        <option>00</option>
                                        <option>30</option>
                                    </select>  
                                     <select name="endmer">
                                        <option>--</option>
                                        <option>AM</option>
                                        <option>PM</option>
                                    </select>
                                </td>
                            </tr>
                            <tr><td>Description:
                                </td><td><textarea name="description" rows="4" cols="30">
                                    </textarea>
                            </td></tr>
                            <tr><td>Saved Locations:
                                </td>
                                <td>
                                    <select name="locationid">
                                        <option value="" onclick="javascript:hide(document.getElementById('locationForm'))">-- Select a Location -- </option>
                                        <%  if(!userProfile.getState().equals("")){
                                            ResultSet locations = location.getLocationsByState(userProfile.getState());
                                            while(locations.next()){%>
                                        <option value="<%=locations.getInt("locationID")%>" onclick="hide(document.getElementById('locationForm'))"><%=locations.getString("title")%>--
                                        <%=locations.getString("city")%>, <%=locations.getString("state")%></option>
                                        <%
                                        }}%>
                                        <option value="notlisted" onclick="javascript:show(document.getElementById('locationForm'))">Not Listed</option>
                                    </select>
                            </td></tr>
                        </table>
                    </fieldset>
                    <!--<a href="javascript:hideshow(document.getElementById('locationForm'))">Hide Show</a> -->
                        
                    
                    <div id="locationForm">
                        <h4 class="heading">Add New Location </h4><br />
                        <fieldset>
                            <legend>Location Information</legend>
                            <table class="eventForm">
                                <tr><td>Location Name:
                                    </td>
                                    <td><input type="text" name="locationTitle" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Street Address:
                                    </td>
                                    <td><input type="text" name="addr1" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Address Line 2:
                                    </td>
                                    <td><input type="text" name="addr2" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        City:
                                    </td>
                                    <td><input type="text" name="city" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        State:
                                    </td>
                                    <td><input type="text" name="state" value="" size="10" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Zip:
                                    </td>
                                    <td><input type="text" name="zip" value="" size="10" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Location Website:
                                    </td>
                                    <td><input type="text" name="website" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Contact Name:
                                    </td>
                                    <td><input type="text" name="contactName" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Contact Email:
                                    </td>
                                    <td><input type="text" name="contactEmail" value="" size="40" />
                                    </td>
                                </tr>
                            </table>
                        </fieldset>
                    </div>
                    <input type="hidden" name="action" value="addevent" />
                    <input type="submit" value="submit" name="submit"  />
                </form>     
                
            </div>
<!--end content -->
<%@ include file="footer.jsp" %>
</div>
</body>
</html>